class Solution {
    public int differenceOfSum(int[] nums) {
        int ret1 = 0, ret2 = 0;
        for (int x : nums) {
            ret1 += x;
            ret2 += fun(x);
        }
        return Math.abs(ret1 - ret2);
    }
    public int fun(int x) {
        int ret = 0;
        while (x > 0) {
            ret += x % 10;
            x /= 10;
        }
        return ret;
    }
}